package com;

import com.zyx.config.SpringConfig;
import com.zyx.entity.Book;
import com.zyx.entity.Student;
import com.zyx.mapper.BookMapper;
import com.zyx.mapper.StudentMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/***
 * @title BookDemo
 * @author zyx
 * @create 2022/4/13 21:44
 **/
@SpringJUnitConfig(classes = SpringConfig.class)
public class BookDemo {

    @Autowired
    BookMapper bm;

    @Autowired
    StudentMapper sm;

    @Test
    void t2(){
        /*Student st = new Student();
        st.setName("李四");
        int add = sm.add(st);
        System.out.println(add);
        System.out.println(st.getId());
        System.out.println(st.getName());*/
        Map<String,Object> map = new HashMap<>();
        map.put("name","赵六");
        sm.add(map);
        System.out.println(map.get("id"));
        System.out.println(map.get("name"));
    }

    @Test
    void t1(){
        List<Book> list = bm.queryAll();
        for (Book b : list){
            System.out.println(b);
        }
    }
}
